#include"ThreadPool.hpp"
#include"Task.hpp"
#include"Log.hpp"

using namespace log_ns;

int main()
{
    EnableScreen();
    // LOG(DEBUG, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // LOG(WARNING, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // LOG(FATAL, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // LOG(ERROR, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // EnableFile();
    // LOG(DEBUG, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // LOG(DEBUG, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // LOG(DEBUG, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);
    // LOG(DEBUG, "hello %d, world: %c, hello: %f\n", 1000, 'A', 3.14);

    // ThreadPool<Task>* tp = new ThreadPool<Task>();
    // tp->Init();
    // tp->Start();
    int cnt = 10;
    while(cnt)
    {
        //不断向线程池推送任务
        sleep(1);
        Task t(1, 1);
        ThreadPool<Task>::GetInstance()->Equeue(t);
        LOG(INFO, "equeue a task, %s\n", t.debug().c_str());
        sleep(1);
        cnt--;
    }
    ThreadPool<Task>::GetInstance()->Stop();
    LOG(INFO, "thread pool stop!\n");
    return 0;
}